package com.batunite.livedatabinding

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.Button
import com.batunite.livedatabinding.views.BoxMapView

class Box2Activity : AppCompatActivity() {

    private lateinit var boxMapView: BoxMapView
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_box2)
        boxMapView = findViewById(R.id.boxMapView)

        // 设置点击事件监听器，当点击按钮时触发人物的移动
        val moveButton = findViewById<Button>(R.id.moveButton)
        moveButton.setOnClickListener {
            // 假设要向右移动一个单位
            boxMapView.movePlayerAndBox(boxMapView.playerX + 1, boxMapView.playerY)
        }
    }
}